export let logout = {
  namespaced: true,
  state: {
    logout_data: {},
  },
  actions: {
    getLogoutData(store, data = {}) {
      let url = "/logout";

      return new Promise((resolve, reject) => {
        axios.get(url).then(({
          data
        }) => {
          store.commit("setLogoutData", data);
          resolve(data);
        }).catch((error) => {
          if (error.response) {
            // 请求已发出，但服务器响应的状态码不在 2xx 范围内
            reject(error.response.data)
          }
        });
      })
    },
  },
  mutations: {
    setLogoutData(state, data) {
      state.logout_data = data;
    },
  }
}
